import Vue from 'vue'
import VueRouter, {RouteConfig} from 'vue-router'


Vue.use(VueRouter)

const routes: Array<RouteConfig> = [

    {
        path: '/user',
        name: 'user',
        redirect: '/user/login',
        component: () => import('@/views/layout/login.vue'),
        children: [
            {
                path: 'login',
                name: 'login',
                component: () => import('@/components/homeView/userLogin.vue'),
            },
            {
                path: 'register',
                name: 'register',
                component: () => import('@/components/homeView/userRegister.vue'),
            },
        ]
    },
    {
        path: '/',
        name: 'home',
        component: () => import('@/views/layout/index.vue'),
        children: [
            // 工作台
            {
                path: 'workbench',
                name: 'workbench',
                component: () => import('@/views/menu/workbench/index.vue'),
                meta: {
                    login_required: true
                }
            },
            // 客户管理
            {
                path: 'client',
                name: 'client',
                component: () => import('@/views/menu/client/index.vue'),
                meta: {
                    title: '客户管理',
                    name: 'client',
                    login_required: true
                }
            },
            // 订单管理
            {
                path: 'order/quotationManage',
                name: 'quotationManage',
                component: () => import('@/views/menu/order/quotationManage.vue'),
                meta: {
                    title: '订单管理-询价单管理',
                    name: 'quotationManage',
                    login_required: true
                }
            },
            {
                path: 'order',
                name: 'order',
                component: () => import('@/views/menu/order/order.vue'),
                meta: {
                    title: '订单管理-订单总览',
                    name: 'order',
                    login_required: true
                }
            },
            // 询价单管理
            {
                path: 'quotation',
                name: 'quotation',
                component: () => import('@/views/menu/quotation/index.vue'),
                meta: {
                    title: '订单管理-询价单管理',
                    name: 'quotation',
                    login_required: true
                }
            },
            // 运输管理
            {
                path: 'transport/tracking',
                name: 'tracking',
                component: () => import('@/views/menu/transport/tracking.vue'),
                meta: {
                    title: '运输管理-在途运输',
                    name: 'tracking',
                    login_required: true
                }
            },
            {
                path: 'transport/transportPlan',
                name: 'transportPlan',
                component: () => import('@/views/menu/transport/transportPlan.vue'),
                meta: {
                    title: '运输管理-运输计划',
                    name: 'transportPlan',
                    login_required: true
                }
            },
            {
                path: 'transport/billLading',
                name: 'billLading',
                component: () => import('@/views/menu/transport/billLading.vue'),
                meta: {
                    title: '运输管理-提货单',
                    name: 'billLading',
                    login_required: true
                }
            },
            {
                path: 'transport/signatureReceipt',
                name: 'signatureReceipt',
                component: () => import('@/views/menu/transport/signatureReceipt.vue'),
                meta: {
                    title: '运输管理-签收单',
                    name: 'signatureReceipt',
                    login_required: true
                }
            },
            {
                path: 'transport/handoverReceipt',
                name: 'handoverReceipt',
                component: () => import('@/views/menu/transport/handoverReceipt.vue'),
                meta: {
                    title: '运输管理-回单交接',
                    name: 'handoverReceipt',
                    login_required: true
                }
            },
            // 报价管理
            {
                path: 'quoted/toBe',
                name: 'toBe',
                component: () => import('@/views/menu/quoted/toBe.vue'),
                meta: {
                    title: '报价管理-待报价订单',
                    name: 'toBe',
                    login_required: true
                }
            },
            {
                path: 'quoted/routine',
                name: 'routine',
                component: () => import('@/views/menu/quoted/routine.vue'),
                meta: {
                    title: '报价管理-常规路线报价',
                    name: 'routine',
                    login_required: true
                }
            },
            // 调度管理
            {
                path: 'dispatch/loading',
                name: 'loading',
                component: () => import('@/views/menu/dispatch/loading.vue'),
                meta: {
                    title: '调度管理-调度配载',
                    name: 'loading',
                    login_required: true
                }
            },
            {
                path: 'dispatch/orderAllot',
                name: 'orderAllot',
                component: () => import('@/views/menu/dispatch/orderAllot.vue'),
                meta: {
                    title: '调度管理-订单配发',
                    name: 'orderAllot',
                    login_required: true
                }
            },
            // 合同管理
            {
                path: 'contract/contractManage',
                name: 'contractManage',
                component: () => import('@/views/menu/contract/contractManage.vue'),
                meta: {
                    title: '合同管理',
                    name: 'contractManage',
                    login_required: true
                }
            },
            {
                path: 'contract/contractStatistics',
                name: 'contractStatistics',
                component: () => import('@/views/menu/contract/contractStatistics.vue'),
                meta: {
                    title: '合同统计',
                    name: 'contractStatistics',
                    login_required: true
                }
            },
            // 回单管理
            {
                path: 'receipt/receiptManage',
                name: 'receiptManage',
                component: () => import('@/views/menu/receipt/receiptManage.vue'),
                meta: {
                    title: '回单管理-回单交接',
                    name: 'receiptManage',
                    login_required: true
                }
            },
            {
                path: 'receipt/signatureReceipt',
                name: 'signatureReceipt',
                component: () => import('@/views/menu/receipt/signatureReceipt.vue'),
                meta: {
                    title: '回单管理-签收单',
                    name: 'signatureReceipt',
                    login_required: true
                }
            },
            {
                path: 'receipt/handoverReceipt',
                name: 'handoverReceipt',
                component: () => import('@/views/menu/receipt/handoverReceipt.vue'),
                meta: {
                    title: '回单管理-回单交接',
                    name: 'handoverReceipt',
                    login_required: true
                }
            },
            // 结算管理
            {
                path: 'settlement/orderSettlement',
                name: 'orderSettlement',
                component: () => import('@/views/menu/settlement/orderSettlement.vue'),
                meta: {
                    title: '结算管理-订单结算',
                    name: 'orderSettlement',
                    login_required: true
                }
            },
            {
                path: 'settlement/receivablesSettlement',
                name: 'receivablesSettlement',
                component: () => import('@/views/menu/settlement/receivablesSettlement.vue'),
                meta: {
                    title: '结算管理-应收款结算',
                    name: 'receivablesSettlement',
                    login_required: true
                }
            },
            {
                path: 'settlement/payableSettlement',
                name: 'payableSettlement',
                component: () => import('@/views/menu/settlement/payableSettlement.vue'),
                meta: {
                    title: '结算管理-应付款结算',
                    name: 'payableSettlement',
                    login_required: true
                }
            },
            {
                path: 'settlement/settlementStatistics',
                name: 'settlementStatistics',
                component: () => import('@/views/menu/settlement/settlementStatistics.vue'),
                meta: {
                    title: '结算管理-结算统计',
                    name: 'settlementStatistics',
                    login_required: true
                }
            },
            // 发票管理
            {
                path: 'invoice',
                name: 'invoice',
                component: () => import('@/views/menu/invoice/index.vue'),
                meta: {
                    title: '发票管理',
                    name: 'invoice',
                    login_required: true
                }
            },
            // 动力资源管理
            {
                path: 'power/carsManage',
                name: 'carsManage',
                component: () => import('@/views/menu/power/carsManage.vue'),
                meta: {
                    title: '动力资源管理-车辆管理',
                    name: 'carsManage',
                    login_required: true
                }
            },
            {
                path: 'power/personManage',
                name: 'personManage',
                component: () => import('@/views/menu/power/personManage.vue'),
                meta: {
                    title: '动力资源管理-成员管理',
                    name: 'personManage',
                    login_required: true
                }
            },
            {
                path: 'power/KPIManage',
                name: 'KPIManage',
                component: () => import('@/views/menu/power/KPIManage.vue'),
                meta: {
                    title: '动力资源管理-KPI数据',
                    name: 'KPIManage',
                    login_required: true
                }
            },
            // 异常管理
            {
                path: 'exception',
                name: 'exception',
                component: () => import('@/views/menu/exception/index.vue'),
                meta: {
                    title: '异常管理',
                    name: 'exception',
                    login_required: true
                }
            },
            // 车辆管理
            {
                path: 'cars',
                name: 'cars',
                component: () => import('@/views/menu/cars/index.vue'),
                meta: {
                    title: '车辆管理',
                    login_required: true
                }
            },
            // 系统设置
            {
                path: 'system/setUp',
                name: 'setUp',
                component: () => import('@/views/menu/system/setUp.vue'),
                meta: {
                    title: '系统设置',
                    login_required: true
                }
            },
            {
                path: 'system/foundation',
                name: 'foundation',
                component: () => import('@/views/menu/system/foundation.vue'),
                meta: {
                    title: '系统设置-基础设置',
                    login_required: true
                }
            },
            {
                path: 'system/outlets',
                name: 'outlets',
                component: () => import('@/views/menu/system/outlets.vue'),
                meta: {
                    title: '系统设置-网点管理',
                    name: 'outlets',
                    login_required: true
                }
            },
            {
                path: 'system/driversAccount',
                name: 'driversAccount',
                component: () => import('@/views/menu/system/driversAccount.vue'),
                meta: {
                    title: '系统设置-司机账号管理',
                    name: 'driversAccount',
                    login_required: true
                }
            },
            {
                path: 'system/person',
                name: 'person',
                component: () => import('@/views/menu/system/person.vue'),
                meta: {
                    title: '系统设置-人员管理',
                    name: 'person',
                    login_required: true
                }
            },
            {
                path: 'system/message',
                name: 'message',
                component: () => import('@/views/menu/system/message.vue'),
                meta: {
                    title: '系统设置-消息管理',
                    name: 'message',
                    login_required: true
                }
            },
            {
                path: 'system/operation',
                name: 'operation',
                component: () => import('@/views/menu/system/operation.vue'),
                meta: {
                    title: '系统设置-操作日志',
                    name: 'operation',
                    login_required: true
                }
            },
            {
                path: 'system/information',
                name: 'information',
                component: () => import('@/views/menu/system/information.vue'),
                meta: {
                    title: '系统设置-资料设置',
                    login_required: true
                }
            },


            // 创建询价单
            {
                path: 'order/createQuotation',
                name: 'createQuotation',
                component: () => import('@/components/order/Quotation.vue'),
                meta: {
                    title: '创建询价单',
                    name: 'createQuotation',
                    login_required: true
                }
            },
            // 创建订单
            {
                path: 'order/createOrder',
                name: 'createOrder',
                component: () => import('@/components/order/Order.vue'),
                meta: {
                    title: '创建订单',
                    name: 'createOrder',
                    login_required: true
                }
            },

            // 查看询价单
            {
                path: 'order/showQuotation',
                name: 'showQuotation',
                component: () => import('@/components/order/ShowQuotation.vue'),
                meta: {
                    title: '查看询价单',
                    name: 'showQuotation',
                    login_required: true
                }
            },
            // 运输路线
            {
                path: 'transport/createTransport',
                name: 'createTransport',
                component: () => import('@/components/transport/TransportRoute.vue'),
                meta: {
                    title: '创建运输路线',
                    name: 'createTransport',
                    login_required: true
                }
            },
            // 处理询价单
            {
                path: 'order/disposeQuotation',
                name: 'disposeQuotation',
                component: () => import('@/components/order/DisposeQuotation.vue'),
                meta: {
                    title: '处理询价单',
                    name: 'disposeQuotation',
                    login_required: true
                }
            },

        ]
    }

]

const router = new VueRouter({
    routes
})

export default router
